﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using LitJson;
using System.IO;
using System.Configuration;

namespace CoolChat
{
    public class Lang
    {
        private JsonData jd;
        public Lang()
        {
            string json = "";
            StreamReader sr = null;
            try
            {
                sr = new StreamReader(HttpContext.Current.Server.MapPath( ConfigurationManager.AppSettings["lan_file"]));
                json = sr.ReadToEnd();
            }
            catch (Exception iex)
            {
                throw iex;
            }
            finally
            {
                if (null != sr)
                    sr.Close();
            }

            jd = JsonMapper.ToObject(json);
            
        }
        public JsonData this[string name]
        {
            get
            {
                return jd[name];
            }
        }
        public JsonData this[int index]
        {
            get
            {
                return jd[index];
            }
        }
        
    }
}